<?php
namespace app\superAdmin\controller;
use \think\Controller;
use \think\Db;


class Order extends Controller 
{
	public function index()
    {
    	$orders = Db::name('order_ck')->select();
    	$this->assign("orderList",$orders);
        return $this->fetch();;
    }
    public function jujue($id){
       
        $ustatenum=Db::name("order_ck")->where("oid='$id'")->value('ostate');

        if($ustatenum！=2){
            if (Db::name("order_ck")->where("oid='$id'")->update(['ostate'=>2])) {
                $this->success('拒绝成功');
            }else{
                $this->error('拒绝失败');
            }

        }

    
    }
    public function tongguo($id){
        $ustatenum=Db::name("order_ck")->where("oid='$id'")->value('ostate');
        if($ustatenum！=1){
            if (Db::name("order_ck")->where("oid='$id'")->update(['ostate'=>1])) {
                $this->success('审核通过成功');
            }else{
                $this->error('审核通过失败');
            }

        }
    }
    public function find(){
        $findoid=input('findoid');
        $findstate=input('findstate');
        $findsid=input('findsid');

        if ($findoid!=NULL) {
            $registration=Db::query("select * from `order_ck` where oid='$findoid'");
            $this->assign("orderList",$registration);
            return $this->fetch("index");
        }elseif ($findstate!=NULL) {
            $registration=Db::query("select * from `order_ck` where ostate='$findstate'");
            $this->assign("orderList",$registration);
            return $this->fetch("index");
        }elseif ($findsid!=NULL) {
            $registration=Db::query("select * from `order_ck` where sid='$findsid'");
            $this->assign("orderList",$registration);
            return $this->fetch("index");
        }else{
            $registration=Db::query("select * from `order_ck`");
            $this->assign("orderList",$registration);
            return $this->fetch("index");
        }
    }

}